package org.extframework.ld.bean.model;

import java.util.Date;

/**
 * @author : Dong.Li
 * @created : 2013-1-21
 * @version : 1.0
 * @description :
 */
public class UpdateInfo extends DomainModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Long creatorId;
	private String creator;
	private Date createdTime;
	private Long lastOperatorId;
	private String lastOperator;
	private Date updateTime;

	public UpdateInfo(IUser user) {
		this.creatorId = (this.lastOperatorId = Long
				.valueOf((user == null) ? 1L : user.getId().longValue()));
		this.creator = (this.lastOperator = (user == null) ? "admin" : user
				.getName());
		this.createdTime = (this.updateTime = new Date());
	}

	public UpdateInfo() {
		super();
		this.createdTime = (this.updateTime = new Date());
	}

	public Long getCreatorId() {
		return creatorId;
	}

	public void setCreatorId(Long creatorId) {
		this.creatorId = creatorId;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public Long getLastOperatorId() {
		return lastOperatorId;
	}

	public void setLastOperatorId(Long lastOperatorId) {
		this.lastOperatorId = lastOperatorId;
	}

	public String getLastOperator() {
		return lastOperator;
	}

	public void setLastOperator(String lastOperator) {
		this.lastOperator = lastOperator;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	public void setUpdateInfo(IUser user) {
		this.lastOperatorId = Long.valueOf((user == null) ? 1L : user.getId().longValue());
		this.lastOperator = ((user == null) ? "admin" : user.getName());
		this.updateTime = new Date();
	}

}
